var TTDConversionEvents;(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{argsToSdkFunction:()=>Se,clearAllConfigs:()=>je,event:()=>Le});var n={tcfV2ConsentVersion:2,consentRequestHasTimedOut:!1,waitForConsentTimeout:null,consentCheckExists:!1,isGdprApplicable:!1,gdprConsentString:null};function r(){return new URL(window.location.href).searchParams.has("upjs_debug")}function i(){return r()||null!=localStorage.getItem("enable-ttd-pixel-debugging")}function o(e){if(!e)return"";var t=void 0!==e.advertiserId&&null!==e.advertiserId?"adv_".concat(e.advertiserId):"merchant_".concat(e.merchantId),n=e.pixelIds&&e.pixelIds.length>0?"|".concat(e.pixelIds.join(",")):"";return"".concat(t).concat(n," ")}function a(e,t){var n=i(),r=(null==t?void 0:t.enableDebug)||!1;if(n||r){var a=o(t);console.info("TTD Pixel v3: ".concat(a).concat(e))}}function c(e,t){var n=i(),r=(null==t?void 0:t.enableDebug)||!1;if(n||r){var a=o(t);console.error("TTD Pixel v3: ".concat(a).concat(e))}}function d(e,t){for(var n=[],r=2;r0?t:void 0}return Array.isArray(e)?e:void 0}}function f(e,t,n){var r=null!=e?"adv_".concat(e):"merchant_".concat(t);return n?"".concat(r,"|").concat(n):r}function p(e,t,n,r,i){r=v(r);for(var o=u(t),l=u(n),s=r&&r.length>0,p=o||l,g=Array.from(new Set(e.values())),h=0,m=s?r.map((function(e){return f(t,n,e)})):[f(t,n)];h0)return a("Partial config match found",w[0]),w.length>1&&d("Multiple partial config matches found, using first one",w[0],w.slice(1)),w[0];if(p)return void c("No matching config found for adv/merchant '"+t+"/"+n+"', event will not fire")}if(!p||!s)return 1===g.length?(a("Single config found, using it for event",g[0]),g[0]):(d("Event ids not sent, will use mostRecentInitConfig",i),i);c("Event sent ids (advId: "+t+", merchantId: "+n+", pixelIds: "+(null==r?void 0:r.join(","))+") but no exact config match found, event will not fire")}var g=function(){return g=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0){var d=c[c.length-1];d&&R(d,r,e)&&(r=d,G(e,"strategy 4: found toporigin: "+d+" from origins: "+c))}}catch(t){G(e,"strategy 4: ancestorOrigins unsupported, continue")}if(!r||P(r)){var l=function(e){try{if((n=document.querySelector("link[rel='canonical']"))&&(r=n.href))return r}catch(t){G(e,"strategy 5: canonical link not accessible in current document")}for(var t=window;;)try{if(t.parent===t)break;var n,r;if((n=(t=t.parent).document.querySelector("link[rel='canonical']"))&&(r=n.href))return r}catch(t){G(e,"strategy 5: cross-origin parent, cannot read canonical link");break}return""}(e);l&&R(l,r,e)&&(r=l,G(e,"strategy 5: canonical url found"))}if(!r||P(r)){var s=function(e,t){try{var n=window.dataLayer;if(!n||!Array.isArray(n))return G(t,"strategy 6: dataLayer not present or not an array"),"";var r="";try{r=e?new URL(e).origin:""}catch(n){G(t,"strategy 6: could not parse known origin: "+e)}for(var i=n.length-1;i>=0;i--){var o=n[i];if(o&&"object"==typeof o&&!Array.isArray(o))for(var a=0,c=A;a1)return r+l;G(t,"strategy 6: dataLayer["+i+"]."+d+" is not a valid URL: "+l)}}}}catch(e){G(t,"strategy 6: error reading dataLayer, continue")}return""}(r,e);s&&R(s,r,e)&&(r=s,G(e,"strategy 6: dataLayer url found: "+s))}var u=function(e,t,n){var r=[];t&&t.includes("?")&&r.push(t),e&&e.includes("?")&&function(e){try{return"/"===new URL(e).pathname||-1!==e.indexOf("cloudfront.net")}catch(e){return!1}}(e)&&r.push(e);for(var i=0,o=r;i0)return;null==e||e.resolveWith(document,[r])}},bindReady:function(){if(!e){if(e=r._Deferred(),"complete"===document.readyState)return setTimeout((function(){return r.ready()}),1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",(function(){return r.ready()}),!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",t),window.attachEvent("onload",r.ready);var n=!1;try{n=null==window.frameElement}catch(e){console.log(e)}document.documentElement.doScroll&&n&&i()}}},_Deferred:function(){var e,t=[],n=!1,i=!1,o={done:function(){for(var n=[],a=0;a0){var a=e.querySelectorAll(p);a&&a.forEach((function(e){r.includes(e)||r.push(e)}))}for(var c=window.location.hostname,d=document.getElementsByTagName("iframe"),l=0,s=Array.from(d);l0&&u.contentDocument.querySelectorAll(p).forEach((function(e){r.includes(e)||r.push(e)}))}}return r}function X(e,t){var n=0,r=null;return new MutationObserver((function(i,o){var a=Date.now(),c=a-n;c>=t?(n=a,e(i,o)):(r&&clearTimeout(r),r=setTimeout((function(){n=Date.now(),e(i,o)}),t-c))}))}function $(e,t){if(!t.src)return!1;try{var n=e===new URL(t.src).hostname;return n&&Z("Iframe "+t.src+" can be accessed"),n}catch(e){return Z("error: ",e),!1}}function Q(e){var t=e.currentTarget;if(t&&t.__upixel_detection)try{H(t.__upixel_detection.root,t.__upixel_detection.scopeName,t.__upixel_detection.config)}catch(e){Z(e)}}function Y(e,t){return function(e,t){var n=/((([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,}))/i;if(t.detectionSubject.includes("email")&&n.test(e)){var r=function(e){return e.toLowerCase().trim()}(e.match(n)[0]);return Z("We detected email: "+r),function(e,t){if(e&&t){var n=new CustomEvent("detected-identifier",{detail:{identifier:e,type:t}});Z("Dispatched event with identifier: ",e," and type: ",t),window.dispatchEvent(n)}}(r,"email"),!0}return!1}(e,t)}function Z(e){for(var t=[],n=1;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?r.map((function(e){return f(t,n,e)})):[f(t,n)],a=0,c=o;a0)||n.includes(oe.pixelId)}(e.adv,e.pixel_ids)&&(se(t.uidConfig)?e.uid2_token=t.uidConfig.uid_token:le(t.uidConfig)&&(e.euid_token=t.uidConfig.uid_token));var k={data:[Ie(Ie({},e),{privacy_settings:y})]};(t.enableDebug||e.debug)&&(k.debug="1"),function(e,t,n){var r=this,i="".concat(e.rootUrl,"/track/realtimeconversion");return a("trigger POST realtime conversion event",e),new Promise((function(o,c){var d=new XMLHttpRequest;d.withCredentials=!0,d.open("POST",i),d.setRequestHeader("Content-type","application/json"),d.setRequestHeader("eventDataSource",e.eventDataSource||"JsSdk"),d.setRequestHeader("eventDataSourceVersion",e.pixelVersion),d.onload=function(){d.status>=200&&d.status<300?o(d.response):c(d.response)},d.onerror=function(){return xe(r,void 0,void 0,(function(){var r;return ke(this,(function(i){return r=function(e){var t,n=null!==(t=e.responseText)&&void 0!==t?t:JSON.parse(e.responseText);return(null==n?void 0:n.Message)?n.Message:0!==e.status||e.responseText?"Status Code ".concat(e.status):"Request never hit server. Possible CSP violation."}(d),c(d.statusText),function(e,t,n,r){var i,o,c,d;xe(this,void 0,void 0,(function(){var l,s,u,v;return ke(this,(function(f){var p,g,h;return l="universal_pixel_realtime_fallback_"+(null!==(d=null!==(o=null===(i=n.pixel_ids)||void 0===i?void 0:i.join("_"))&&void 0!==o?o:null===(c=e.pixelIds)||void 0===c?void 0:c.join("_"))&&void 0!==d?d:""),a("trigger GET realtime conversion event fallback",e),p=t.data[0],g=Object.entries(p).filter((function(e){var t=e[0],n=e[1];return("string"==typeof n||"number"==typeof n||"boolean"==typeof n||"pixel_ids"===t)&&null!=n&&""!==n})),h=new URLSearchParams,g.forEach((function(e){var t=e[0],n=e[1];h.append(t,String(n))})),s=h,u=(e.eventDataSource||"JsSdk")+"Get",v=e.pixelVersion,s.set("eds",u),s.set("edsv",v),s.set("rt_fallback","1"),""!==r&&s.set("rt_fbErr",r),C("".concat(e.rootUrl,"/track/rt?").concat(s.toString()),l,"TTD Universal Pixel Realtime Fallback"),[2]}))}))}(e,t,n,r),[2]}))}))},d.send(JSON.stringify(t))}))}(t,k,e).catch((function(e){return c(e,t)}))}window.ttdConversionEventsLayer=window.ttdConversionEventsLayer||[],window.ttdConversionEvents=null!==(_e=window.ttdConversionEvents)&&void 0!==_e?_e:{activeDetection:null,startDetection:null},function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i